package jrdcom.com.jrdmovie.Glide;

import android.content.Context;
import android.widget.ImageView;

import com.bumptech.glide.Glide;

/**
 * Created by longcheng on 17/3/8.
 */
public class JrdImageLoader implements IimageLoader {
    @Override
    public void init() {

    }

    @Override
    public void displayImage(String imageUri, ImageView imageView, Context mContext) {
        Glide.with(mContext)
                .load(imageUri)
                .into(imageView);
    }

    @Override
    public void displayImage(String imageUri, ImageView imageView, int errorImage, int loadImage, Context mContext) {
        Glide.with(mContext)
                .load(imageUri)
                .placeholder(loadImage)
                .error(errorImage)
                .into(imageView);
    }

    @Override
    public void displayImage(String imageUri, ImageView imageView, int errorImage, int loadImage, Context mContext, boolean isBitmap) {
        if(true == isBitmap){
            Glide.with(mContext)
                    .load(imageUri)
                    .asBitmap()
                    .placeholder(loadImage)
                    .error(errorImage)
                    .into(imageView);
        }else{
            Glide.with(mContext)
                    .load(imageUri)
                    .asGif()
                    .placeholder(loadImage)
                    .error(errorImage)
                    .into(imageView);
        }

    }
}
